Repository navigation
Conversation
|
@copilot Please address the three comments on this PR. |
Addressed all three comments in edb67fe and 866d93b. Launcher handling now preserves safe arguments after fixed non-shell commands, recognizes the missing wrappers, and includes GOOD cases for literals, lists, and mutable arrays. Added safeguards and regressions for unresolved commands and mutated aliases. All four CWE-078 tests pass; final read-only review found no issues. The automated security scan was skipped because its database was too large. |
There was a problem hiding this comment.
Note
Copilot was unable to run its full agentic suite in this review.
Copilot review overview
6 open findings
ThisforallquantifiesSsaDefinition defbut then unconditionally castsdefto… · Newexists(...)is used with an expression (exists(this.getArgument(...))), which is not valid QL… · NewcommandOperandre-binds thelauncherparameter usingthis.getFixedArgument(_), which can… · Newexists(...)is used with an expression (exists(this.getArgument(...))), which is not valid QL… · NewisShellaccounts for Windows-style.exesuffixes, butisDelegatingLauncherdoes not. This… · NewunknownIndex[arg.length()]can throwArrayIndexOutOfBoundsExceptionfor most inputs (since the… · New
What changed in this PR
Updates the Java CWE-078 CodeQL modeling and tests to better distinguish delegating “launcher” executables (for example env, sudo, timeout) from shells, improving command-injection and relative-path detection accuracy.
Changes:
- Extend
isSafeCommandArgumentto handle delegating launchers by analyzing fixed command prefixes across arrays/lists/mutable arrays. - Add new test cases covering launcher delegation scenarios and update expected query outputs accordingly.
- Introduce new argument-sequence abstraction (
CommandArguments) and supporting utilities for alias/escape tracking.
| File | Description |
|---|---|
| java/ql/test/query-tests/security/CWE-078/Test.java | Adds new ProcessBuilder test cases for delegating launchers, argument mutation/aliasing, and fixed-vs-tainted scenarios. |
| java/ql/test/query-tests/security/CWE-078/ExecTainted.expected | Updates expected taint-tracking results to include new test cases and shifted line numbers. |
| java/ql/test/query-tests/security/CWE-078/ExecRelative.expected | Updates expected relative-path command results for newly added launcher cases and shifted line numbers. |
| java/ql/lib/semmle/code/java/security/CommandArguments.qll | Implements launcher-aware safe-argument logic, including prefix inspection and container escape tracking. |
🧠 Review effort: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
@copilot Address review comments. |
4edf3dd to
f1d360c
Compare
Document supported simple forms and known limitations with inline expectations. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
f1d360c to
f627764
Compare
f627764 to
78f0ba2
Compare
Recognize fixed command positions without parsing launcher options. Only sanitize later arguments when the delegated command is one unchanged string literal. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
78f0ba2 to
8f59bbb
Compare
I've changed my mind about supporting lots and lots of delegating launchers. Better to keep it simple.


Improves
java/command-line-injectionby detecting tainted commands passed through simple delegating launchers such asenv,sudo, andtimeout.The change:
Launcher options and environment assignments are intentionally left unsupported to keep the implementation simple and conservative.
--
I originally set Copilot to work on this, but it got bogged down in trying to make everything precise. In this case, we just want to see if we can do better than we are currently doing, while keeping things relatively simple. I have tried to strike the right balance in this PR.